var express = require('express');
var router = express.Router();

const shelfItem = require("../controller/shelfItem");
const auth = require("../controller/auth");

router.all("*",auth.isLogin);
//查询过期的物品
router.get('/expiredItems/:val', auth.isAdmin,shelfItem.getExpiredItems);
//出库操作
router.put("/outbound/:id", auth.isAdmin, shelfItem.outbound);
//按照status获取物品列表
router.get("/searchByStatus", auth.isAdmin, shelfItem.searchByStatus);
//获取用户自己的物品列表
router.get("/searchSelfByStatus", shelfItem.searchSelfByStatus);
//查询货架数量
router.get("/count", auth.isAdmin,shelfItem.getCount);     
//修改货架
router.put("/:id", auth.isAdmin, shelfItem.update);

//增加货架
router.post("/", auth.isAdmin, shelfItem.add);
//查找指定id货架
router.get("/:id", auth.isAdmin, shelfItem.find);
//删除货架
router.delete("/:id", auth.isAdmin, shelfItem.remove);  
//查询货架列表
router.get("/", auth.isAdmin,shelfItem.findAll);

module.exports = router;